import { fileURLToPath, URL } from 'node:url'

import CopyPlugin from 'rollup-plugin-copy'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          // treat all tags with a ui5- as custom elements
          isCustomElement: tag => (tag.includes('ui5-') ||  tag.includes('custom-'))
        }
      }
    }),CopyPlugin({
      targets: [
        { src:'./manifest.json', dest: './dist/'},
        { src:'./xs-app.json', dest: './dist/'},
        { src:'../package.json', dest: './dist/'},
      ],
      hook: 'generateBundle'
    }),
  ],
  base:'./',
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
